#pragma once

#include <string>
#include <list>
#include <map>

#include <boost/enable_shared_from_this.hpp>

#include "cmd_handler.h"

namespace anb { namespace net {

class dispatcher : public boost::enable_shared_from_this<uvo> {
public:

	dispatcher();
	virtual ~dispatcher();

	typedef boost::shared_ptr<dispatcher> ptr;

	cmd_handler::ptr get_cmd_handler(unsigned short cmd);
	cmd_handler::ptr get_cmd_handler(const std::string& cmd);

	void clear();

protected:
	
private:
	std::list<cmd_handler::ptr> m_handlers;
	std::map<unsigned short, cmd_handler::ptr> m_handlers_by_cmd;
	std::map<std::string, cmd_handler::ptr> m_handlers_by_name;
};

} }